//
//  BoZeCarModel.swift
//  BoZeCalendar
//
//  Created by 李东 on 2024/4/11.
//

import UIKit
import HandyJSON

class BoZeCarModel: HandyJSON {
    required init() {
        
    }
    
    var ids = 0
    var carIcon = ""
    var carType = ""
    var carName = ""
    var list = [BoZeOilModel]()
    
    init(ids: Int = 0, 
         carIcon: String = "",
         carType: String = "",
         carName: String = "") {
        self.ids = ids
        self.carIcon = carIcon
        self.carType = carType
        self.carName = carName
    }
    
    func addOil(mm: BoZeOilModel) {
        list.append(mm)
        let newList =  list.sorted(by: { m1, m2 in
            m1.ts > m2.ts
        })
        list = newList
        
        BoZeDataHelper.shared.addData(model: self)
    }
}


class BoZeOilModel: HandyJSON {
    required init() {
        
    }
    
    var ts = 0
    var ymd_time = ""
    var price = ""
    var km = 0
    var addOil = 0
    var remainOil = 0
    var cost = ""
    
    init(ts: Int = 0, ymd_time: String = "", price: String = "", km: Int = 0, addOil: Int = 0, remainOil: Int = 0, cost: String = "") {
        self.ts = ts
        self.ymd_time = ymd_time
        self.price = price
        self.km = km
        self.addOil = addOil
        self.remainOil = remainOil
        self.cost = cost
    }
    
}

class BoZeTypeModel: HandyJSON {
    required init() {
        
    }
    
    var typeName = ""
    var isSelect = false
    var selectIconName = ""
    var unSelectIconName = ""
    var normalIconName = ""
    
    init(typeName: String = "", isSelect: Bool = false, selectIconName: String = "", unSelectIconName: String = "", normalIconName: String = "") {
        self.typeName = typeName
        self.isSelect = isSelect
        self.selectIconName = selectIconName
        self.unSelectIconName = unSelectIconName
        self.normalIconName = normalIconName
    }
}
